package com.yuncheng.spcyApi.controller;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.yuncheng.spcyApi.selectXzxkApi.api.XzspJkApi;
import com.yuncheng.spcyApi.busService.*;
import com.yuncheng.spcyApi.config.SpcyMinioUtils;
import com.yuncheng.spcyApi.constant.schedule.ScheduleConstant;
import com.yuncheng.spcyApi.constant.common.SpcyConstant;
import com.yuncheng.spcyApi.entity.*;
import com.yuncheng.spcyApi.mapper.SpcySqsxWjjlMapper;
import com.yuncheng.spcyApi.selectXzxkApi.api.XzspTqApi;
import com.yuncheng.spcyApi.selectXzxkApi.vo.BusinessDept;
import com.yuncheng.spcyApi.selectXzxkApi.vo.XzspJkApiSlxxVo;
import com.yuncheng.spcyApi.selectXzxkApi.vo.XzspJkApiSpcyjlVo;
import com.yuncheng.spcyApi.service.*;
import com.yuncheng.spcyApi.spcyService.*;
import com.yuncheng.spcyApi.utils.*;
import com.yuncheng.spcyApi.vo.common.Result;
import com.yuncheng.spcyApi.webOffice.WebOfficeFile;
import com.yuncheng.vo.CurrentUserVo;
import com.yuncheng.vo.HttpResult;
import io.minio.errors.*;
import io.minio.messages.Item;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import utils.DateConversionUtils;
import utils.Util;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.util.*;

@Api(tags = "审评查验-测试接口")
@RestController
@RequestMapping("/api/spzx-spcy/test")
public class TestController {

    private static final Logger log = LoggerFactory.getLogger(TestController.class);

    @Resource
    private ISpcyScheduleJobBasicService spcyScheduleJobBasicService;

    @Resource
    private XzspJkApi xzspJkApi;

    @Resource
    private WebOfficeFile webOfficeFIle;

    @Resource
    private ISpcySqsxWjjlService spcySqsxWjjlService;

    @Resource
    private ISpcySqsxBaiscService spcySqsxBaiscService;

    @Resource
    private ISpcySqsxJcxmService spcySqsxJcxmService;

    @Resource
    private SpcyMinioUtils spcyMinioUtils;

    @Resource
    private LocalFileUploadUtils localFileUploadUtils;

    @Resource
    private SendMailUtils sendMailUtils;

    @Resource
    private ISpcyRsJjrkService spcyRsJjrkService;

    @Resource
    private FlowJobBlsxService flowJobBlsxService;

    @Resource
    @Lazy
    private BusService busService;

    @Resource
    private SpcyFlfgService spcyFlfgService;

    @Resource
    @Lazy
    private SpcyQyInfoService spcyQyInfoService;

    @Resource
    @Lazy
    private SpcyJcydjbService spcyJcydjbService;

    @Resource
    @Lazy
    private SqsxQywjclService sqsxQywjclService;

    @Resource
    @Lazy
    private SpcySqsxWjjlMapper spcySqsxWjjlMapper;

    @Resource
    @Lazy
    private SpcyJcyService spcyJcyService;

    @Resource
    @Lazy
    private XzspTqApi xzspTqApi;

    @ApiOperation(value = "指定提取-政务-现场检查任务")
    @GetMapping(value = "zdTqXcjcrw")
    public HttpResult zdTqXcjcrw(@RequestParam(value = "fsqdbh",defaultValue = "")String fsqdbh){

        if (StringUtils.isBlank(fsqdbh)){
            return HttpResult.error("参数为空！");
        }

        String error = xzspTqApi.appointTqXcjcrw(fsqdbh, null);
        if (StringUtils.isNotBlank(error)){
            return HttpResult.error(error);
        }

        return HttpResult.ok();
    }

    @ApiOperation(value = "中心人员-身份证号信息同步-手机号同步")
    @GetMapping(value = "syncSpcyCenterUserInfo")
    public HttpResult syncSpcyCenterUserInfo(@RequestParam(value = "orgName",defaultValue = "")String orgName){
        spcyJcyService.syncSpcyCenterUserInfo(orgName);
        return HttpResult.ok();
    }

    @ApiOperation(value = "初始化检查员数据-20231227")
    @PostMapping(value = "initUploadJcyData")
    public void initUploadJcyData(@RequestParam("file")MultipartFile file,
                                  @RequestParam(value = "fxllx",defaultValue = "")String fxllx,
                                  @RequestParam(value = "fjcylb",defaultValue = "")String fjcylb,
                                  @RequestParam(value = "fjcyxl",defaultValue = "")String fjcyxl,HttpServletResponse response){
        spcyJcyService.initUploadJcyData(file,fxllx,fjcylb,fjcyxl,response);
    }

    @ApiOperation(value = "获取当前用户信息")
    @GetMapping(value = "getNowUser")
    public HttpResult getNowUser(){
        return HttpResult.ok(GetCurrentUserUtils.getCurrentUser());
    }

    @ApiOperation(value = "清空文件记录-申请事项")
    @GetMapping(value = "qkSqsxAllWjjl")
    public HttpResult qkSqsxAllWjjl(){
        List<SpcySqsxWjjl> allWjjlSqsx = spcySqsxWjjlMapper.findAllWjjlSqsx();
        for (SpcySqsxWjjl wjjl : allWjjlSqsx){
            boolean remove = spcyMinioUtils.remove(localFileUploadUtils.getSqsxWjjlRelativeUrl(wjjl.getFcflj()));
            log.info("remove: {}",remove);
        }
        return HttpResult.ok("删除成功");
    }

    @ApiOperation(value = "清空文件-指定文件路径")
    @PostMapping(value = "qkzdwjUrl")
    public HttpResult qkzdwjUrl(@RequestBody HashMap<String, String> buffer){

        spcyMinioUtils.remove(buffer.get("url"));

        return HttpResult.ok("删除成功");
    }

    @ApiOperation(value = "查询minio指定文件夹所有文件")
    @GetMapping(value = "selectMinioMkdirAllFile")
    public HttpResult selectMinioMkdirAllFile(@RequestParam(value = "ml",defaultValue = "")String ml) throws IOException, InvalidKeyException, InvalidResponseException, InsufficientDataException, NoSuchAlgorithmException, ServerException, InternalException, XmlParserException, ErrorResponseException {
        Iterable<io.minio.Result<Item>> results = spcyMinioUtils.listObjects(ml);

        List<String> resultList = new ArrayList<>();
        for(io.minio.Result<Item> item : results){
            resultList.add(item.get().objectName());
        }
        return HttpResult.ok(resultList);
    }

    @ApiOperation(value = "清空minio指定文件夹所有文件")
    @GetMapping(value = "qkMinioMkdirAllFile")
    public HttpResult qkMinioMkdirAllFile(@RequestParam(value = "ml",defaultValue = "")String ml){
        spcyMinioUtils.removeObjects(ml);
        return HttpResult.ok("删除成功");
    }

    @ApiOperation(value = "同步政务服务-申请事项")
    @GetMapping(value = "syncZwfwSqsx")
    public HttpResult syncZwfwSqsx(@RequestParam(value = "id",defaultValue = "")String id,
                                   @RequestParam(value = "fywflcode",defaultValue = "")String fywflcode){
        sqsxQywjclService.syncZwxtSqsxFlowByTest(id, fywflcode);
        return HttpResult.ok("同步成功");
    }

    @ApiOperation(value = "同步政务服务-申请事项2")
    @GetMapping(value = "syncZwfwSqsx2")
    public HttpResult syncZwfwSqsx2(@RequestParam(value = "sqdbh",defaultValue = "")String sqdbh,
                                   @RequestParam(value = "fywflcode",defaultValue = "")String fywflcode){
        sqsxQywjclService.syncZwxtSqsxFlowByTest2(sqdbh, fywflcode);
        return HttpResult.ok("同步成功");
    }

    @ApiOperation(value = "批量同步政务服务-申请事项")
    @GetMapping(value = "plSyncZwfwSqsx")
    public HttpResult plSyncZwfwSqsx(@RequestParam(value = "sqdbh",defaultValue = "")String sqdbhs,
                                    @RequestParam(value = "fywflcode",defaultValue = "")String fywflcode){
        List<String> sqdbhList = StringPatternUtils.getListByIds(sqdbhs);
        for (String sqdbh : sqdbhList) {
            try {
                sqsxQywjclService.syncZwxtSqsxFlowByTest2(sqdbh, fywflcode);
            }catch (Exception e){
                log.error("批量同步政务服务-申请事项： {}:{}", sqdbh, e.getMessage());
            }
        }
        return HttpResult.ok("同步成功");
    }

    @ApiOperation(value = "同步政务服务-企业信息")
    @GetMapping(value = "syncZwfwXdrxx")
    public HttpResult syncZwfwXdrxx(@RequestParam(value = "fqylx",defaultValue = "")String fqylx){
        spcyQyInfoService.syncZwfwXdrxx(fqylx, 100);
        return HttpResult.ok("同步成功");
    }

    @ApiOperation(value = "同步政务服务-企业关键人员信息")
    @GetMapping(value = "syncZwfwGjryxx")
    public HttpResult syncZwfwGjryxx(@RequestParam(value = "tyshxydm",defaultValue = "")String tyshxydm){

        Result result = spcyQyInfoService.syncZwfwGjryxx(tyshxydm);
        if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }
        return HttpResult.ok("同步成功");
    }

    @ApiOperation(value = "给填写中的检查员登记表发送短信")
    @GetMapping(value = "sendSmsToTxzJcydjb")
    public HttpResult sendSmsToTxzJcydjb() throws NoSuchAlgorithmException, IOException, InvalidKeySpecException {
        spcyJcydjbService.sendSmsToTxzJcydjb();
        return HttpResult.ok("发送成功");
    }

    @ApiOperation(value = "索引条款关键字查询")
    @GetMapping(value = "queryTkList")
    public HttpResult queryTkList(@RequestParam(value = "gjz", defaultValue = "")String gjz,
                                  @RequestParam(value = "zjid",defaultValue = "")String zjid){

//        List<FgTkPo> fgTkPoList = fgTkIndexService.queryList(gjz, zjid);

        return HttpResult.ok();
    }

    @ApiOperation(value = "索引现场检查问题关键字查询")
    @GetMapping(value = "queryXcjcwtList")
    public HttpResult queryXcjcwtList(@RequestParam(value = "gjz", defaultValue = "")String gjz,
                                  @RequestParam(value = "fxcjczjid",defaultValue = "")String fxcjczjid){

//        List<FgXcjcwtPo> list = fgXcjcwtIndexService.queryList(gjz, fxcjczjid);

        return HttpResult.ok();
    }

    @ApiOperation(value = "初始化法律法规条款索引")
    @GetMapping(value = "inintTk")
    public HttpResult inintTk(){

//        fgTkIndexService.inintTk();

        return HttpResult.ok();
    }

    @ApiOperation(value = "初始化法律法规现场检查问题索引")
    @GetMapping(value = "inintXcjcwt")
    public HttpResult inintXcjcwt(){

//        fgXcjcwtIndexService.inintXcjcwt();

        return HttpResult.ok();
    }

    @ApiOperation(value = "删除所有条款1")
    @GetMapping(value = "deleteAllIndexTkById")
    public HttpResult deleteAllIndexTkById(@RequestParam(value = "id", defaultValue = "")String id){

//        fgTkIndexService.deleteAllIndexTkById(id);
        /*List<FgTkPo> fgTkPoList = fgTkIndexService.queryList2("人民共和国药品管", "f533697e9ee74c488d41ceaed657b65a");
        System.out.println(JSONObject.toJSONString(fgTkPoList));*/

        return HttpResult.ok();
    }

    @ApiOperation(value = "删除所有条款2")
    @GetMapping(value = "deleteAllIndexTkById2")
    public HttpResult deleteAllIndexTkById2(@RequestParam(value = "id", defaultValue = "")String id){

//        fgTkIndexService.deleteAllIndexTkById2(id);

        return HttpResult.ok();
    }

    @ApiOperation(value = "删除所有所有条款")
    @GetMapping(value = "deleteAllIndexTk")
    public HttpResult deleteAllIndexTk(){

//        fgTkIndexService.deleteAllIndexTk();
        return HttpResult.ok();
    }

    @ApiOperation(value = "删除所有所有现场检查问题")
    @GetMapping(value = "deleteAllIndexXcjcwt")
    public HttpResult deleteAllIndexXcjcwt(){

//        fgXcjcwtIndexService.deleteAllIndex();
        return HttpResult.ok();
    }

    @ApiOperation(value = "添加索引条款")
    @PostMapping(value = "addIndexTk")
    public HttpResult addIndexTk(@RequestBody SpcyFgTk tk){

//        fgTkIndexService.addIndexTk(tk);

        return HttpResult.ok();
    }

    @ApiOperation(value = "初始库法律法规库")
    @GetMapping(value = "initFlfgInYpsc")
    public HttpResult initFlfgInYpsc(@RequestParam(value = "fywflcode",defaultValue = "")String fywflcode,
                                     @RequestParam(value = "fzdwjid",defaultValue = "")String fzdwjid){
        if (StringUtils.isBlank(fywflcode)) {
            spcyFlfgService.initFlfgInYpsc(fzdwjid);
        }else if (fywflcode.equals(SpcyConstant.YWFL_CODE_YPSC)){
            spcyFlfgService.initFlfgInYpsc(fzdwjid);
        }else if (fywflcode.equals(SpcyConstant.YWFL_CODE_YPZC)){
            spcyFlfgService.initFlfgInYpzc(fzdwjid);
        }else if (fywflcode.equals(SpcyConstant.YWFL_CODE_YPJY)){
            spcyFlfgService.initFlfgInYplt(fzdwjid);
        }else if (fywflcode.equals(SpcyConstant.YWFL_CODE_YLQX)){
            spcyFlfgService.initFlfgInYlqx(fzdwjid);
        }else if (fywflcode.equals(SpcyConstant.YWFL_CODE_HZP)){
            spcyFlfgService.initFlfgInHzp(fzdwjid);
        }
        return HttpResult.ok("生成成功");
    }

    @ApiOperation(value = "初始化检查项目库转为法律法规库")
    @GetMapping(value = "initJcxmToFlfg")
    public HttpResult initJcxmToFlfg(@RequestParam(value = "code",defaultValue = "")String code,
                                     @RequestParam(value = "fzdwjid",defaultValue = "")String fzdwjid){
        if (StringUtils.isNotBlank(code)) {
            spcyFlfgService.initFlfgInYpscNew(fzdwjid, code);
        }
        return HttpResult.ok("生成成功");
    }

    @GetMapping(value = "sendxld")
    public HttpResult sendxld(){

        return HttpResult.ok();
    }

    @GetMapping(value = "getCurrentUser")
    public HttpResult getCurrentUser(){
        return HttpResult.ok(GetCurrentUserUtils.getCurrentUser());
    }

    @GetMapping(value = "updateWtsJobList")
    public HttpResult updateWtsJobList(@RequestParam("sqsxid")String sqsxid){

        busService.updateWtsJobList(sqsxid);
        return HttpResult.ok();
    }

    @GetMapping(value = "getJzrqBygzrJRq")
    public HttpResult getJzrqBygzrJRq(@RequestParam(value = "gzr",defaultValue = "")String gzr){
        Date date = new Date();
        System.out.println(DateConversionUtils.DateToDays(date));
        Date jzrqBygzrJRq = flowJobBlsxService.getJzrqBygzrJRq(date, gzr);
        System.out.println(DateConversionUtils.DateToDays(jzrqBygzrJRq));

        return HttpResult.ok();
    }

    @GetMapping(value = "jsgzr")
    public HttpResult jsgzr(@RequestParam("kssj")String kssj,@RequestParam("jssj")String jssj){
        DateTime ksDate = DateUtil.parse(kssj);
        DateTime jsDate = DateUtil.parse(jssj);

        // 对日期进行判断
        Date finaStartDate = spcyRsJjrkService.judgeStart(ksDate, jsDate);
        Date finaEndDate = spcyRsJjrkService.judgeEnd(ksDate, jsDate);

        BigDecimal bigDecimal = spcyRsJjrkService.wxDays(finaStartDate,finaEndDate);
        return HttpResult.ok(bigDecimal.toString());
    }

    @PostMapping(value = "uploadMinio")
    public HttpResult<?> uploadMinio(@RequestParam("file")MultipartFile file,@RequestParam("url")String url,@RequestParam(value = "bucketName",defaultValue = "")String bucketName){
        spcyMinioUtils.uploadFile(file,bucketName,url);

        return HttpResult.ok("上传成功");
    }

    @GetMapping(value = "downMinio")
    public void downMinio(@RequestParam("url")String url,@RequestParam(value = "bucketName",defaultValue = "")String bucketName,HttpServletResponse response){
        spcyMinioUtils.download(url,bucketName,response);

    }

    @PostMapping(value = "uploadMinioFile")
    public void uploadMinioFile(@RequestBody Map<String,String> map){
        String url = map.get("url");
        String absUrl = map.get("absUrl");
        String wjhz = map.get("wjhz");
        spcyMinioUtils.putFile(url,new File(absUrl),wjhz);

    }

    @GetMapping(value = "getObjectMinio")
    public void getObjectMinio(@RequestParam("url")String url){
        InputStream object = spcyMinioUtils.getObject(url);
        localFileUploadUtils.asFile(object, Util.getWjHz(url));
    }

    @GetMapping(value = "sendEmail")
    public void sendEmail(@RequestParam(value = "title",defaultValue = "")String title,
                          @RequestParam(value = "content",defaultValue = "")String content,
                          @RequestParam(value = "sendTo",defaultValue = "")String sendTo){
        sendMailUtils.sendMail(title,content,sendTo,null,null);
    }

    @GetMapping(value = "downXzspMinio")
    public void downXzspMinio(@RequestParam("fileName")String fileName, HttpServletResponse response){
        spcyMinioUtils.downLoadXzspFile(fileName,response);
    }

    @GetMapping(value = "previewXzspMinio")
    public HttpResult<?> previewXzspMinio(@RequestParam("fileName")String fileName){
        String preview = spcyMinioUtils.previewXzspFile(fileName);

        return HttpResult.ok(preview);
    }

    @GetMapping(value = "getQkhzpgInYplt")
    public HttpResult<?> getQkhzpgInYplt(@RequestParam("sqsxid")String sqsxid){
        SpcySqsxBasic sqsx = spcySqsxBaiscService.getById(sqsxid);
        String qkhzpg= spcySqsxJcxmService.getQkhzpgInYplt(sqsxid, sqsx.getFsxmc());

        return HttpResult.ok(qkhzpg);
    }

    @GetMapping(value = "getToken")
    public HttpResult<?> getToken(){
        String token = xzspJkApi.getToken();
        Map res = new HashMap();
        res.put("token",token);
        return HttpResult.ok(res);
    }

    @GetMapping(value = "tqSqsx")
    public HttpResult<?> tqSqsx(){
        SpcyRsJlxcrwsj timeStamp = xzspJkApi.getTimeStamp();

        SpcyScheduleJobBasic jobBasic = new SpcyScheduleJobBasic();
        jobBasic.setId(GetUuIdUtils.ReplaceUuId());
        jobBasic.setFmethod("getXzspData");
        jobBasic.setFrwmc(ScheduleConstant.rw_name_getXzspData); // 任务名称
        jobBasic.setFzxsj(timeStamp.getFsjc());
        spcyScheduleJobBasicService.save(jobBasic);
        CurrentUserVo currentUser = GetCurrentUserUtils.getCurrentUser();
        xzspJkApi.tqSqsx(timeStamp.getFsjc(),null,currentUser,jobBasic,null); // 获取数据

        jobBasic.setFjssj(new Date());
        spcyScheduleJobBasicService.updateById(jobBasic);
        return HttpResult.ok("success");
    }

    @GetMapping(value = "tsSlxx")
    public HttpResult<?> tsSlxx(XzspJkApiSlxxVo xzspJkApiSlxxVo){
        xzspJkApi.tsSlxx(xzspJkApiSlxxVo,null);
        return HttpResult.ok("success");
    }

    @GetMapping(value = "tsSpcyjl")
    public HttpResult<?> tsSpcyjl(XzspJkApiSpcyjlVo xzspJkApiSpcyjlVo){
        xzspJkApi.tsSpcyjl(xzspJkApiSpcyjlVo,null);
        return HttpResult.ok("success");
    }

    @GetMapping(value = "tsJccl")
    public HttpResult<?> tsJccl(String sqsxid){
        File file = new File("D:/upFiles/测试文档.doc");
        xzspJkApi.tsJccl(file,"测试文档.doc",sqsxid,"admin");
        return HttpResult.ok("success");
    }

    @GetMapping(value = "tqYwbmjbr")
    public HttpResult<?> tqYwbmjbr(String id){
        List<BusinessDept> businessDepts = xzspJkApi.tqYwbmjbr(id);
        return HttpResult.ok(businessDepts);
    }

    @GetMapping(value = "oatest")
    public HttpResult<?> oatest(){


        return HttpResult.ok("");
    }

    @GetMapping(value = "WebOfficeUploadFile")
    public HttpResult<?> WebOfficeUploadFile(String id){
        SpcySqsxWjjl wjjl = spcySqsxWjjlService.getById(id);
        if (wjjl == null){
            return HttpResult.error("文件不存在");
        }
        Result result = webOfficeFIle.uploadWebOfficeFile(wjjl,wjjl.getFwjccmc(), wjjl.getFcflj());
        if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }
        return HttpResult.ok("上传成功");
    }

    @GetMapping(value = "getDocxToPdf")
    public HttpResult<?> getDocxToPdf(String id){
        SpcySqsxWjjl wjjl = spcySqsxWjjlService.getById(id);
        if (wjjl == null){
            return HttpResult.error("文件不存在");
        }
        Result result = webOfficeFIle.getDocxToPdfFile(wjjl, wjjl.getFcflj());
        if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }
        return HttpResult.ok("转换成功");
    }

    @GetMapping(value = "getWebOfficeDownloadFile")
    public HttpResult<?> getWebOfficeDownloadFile(String id,boolean isDel){
        isDel = false;
        SpcySqsxWjjl wjjl = spcySqsxWjjlService.getById(id);
        if (wjjl == null){
            return HttpResult.error("文件不存在");
        }
        webOfficeFIle.getWebOfficeDownloadFile2(wjjl, wjjl.getFcflj(), isDel);
        /*if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }*/
        return HttpResult.ok("下载成功");
    }

    @GetMapping(value = "openFile")
    public HttpResult<?> openFile(String id){
        SpcySqsxWjjl wjjl = spcySqsxWjjlService.getById(id);
        if (wjjl == null){
            return HttpResult.error("文件不存在");
        }
        String url = webOfficeFIle.openFile(wjjl,wjjl.getId(),wjjl.getFcflj(),1,0);
        Map resultMap = new HashMap();
        resultMap.put("wordUrl",url);
        /*if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }*/
        return HttpResult.ok(resultMap);
    }

    @GetMapping(value = "isOpenFile")
    public HttpResult<?> isOpenFile(String id,boolean isDel){
        isDel = false;
        SpcySqsxWjjl wjjl = spcySqsxWjjlService.getById(id);
        if (wjjl == null){
            return HttpResult.error("文件不存在");
        }
        boolean openFile = webOfficeFIle.isOpenFile(wjjl.getId());
        if (openFile){
            return HttpResult.error("文档已打开");
        }
        /*if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }*/
        return HttpResult.ok("文档未打开");
    }

    @GetMapping(value = "closeFile")
    public HttpResult<?> closeFile(String id){
        SpcySqsxWjjl wjjl = spcySqsxWjjlService.getById(id);
        if (wjjl == null){
            return HttpResult.error("文件不存在");
        }
        Result result = webOfficeFIle.closeFile(wjjl.getId());
        if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }
        /*if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }*/
        return HttpResult.ok("关闭成功");
    }

    @GetMapping(value = "closeFile2")
    public HttpResult<?> closeFile2(String id){

        Result result = webOfficeFIle.closeFile(id);
        if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }

        return HttpResult.ok("关闭成功");
    }

    @GetMapping(value = "deleteOfficeFile")
    public HttpResult deleteOfficeFile(String fcflj){

        webOfficeFIle.deleteFile(fcflj);

        return HttpResult.ok("关闭成功");
    }

}
